import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
import LoginView from '../views/LoginView.vue';
import TeaListView from '../views/TeaListView.vue';
import OrderListView from '../views/OrderListView.vue';
import CartView from '../views/CartView.vue';
import RegisterView from '../views/RegisterView.vue';
import UserCenterView from '../views/UserCenterView.vue';
import CommentView from '../views/CommentView.vue';
import TeaDetailView from '../views/TeaDetailView.vue';
import CheckoutView from '../views/CheckoutView.vue';
import OrderDetailView from '../views/OrderDetailView.vue';

const routes: Array<RouteRecordRaw> = [
  { path: '/login', name: 'Login', component: LoginView },
  { path: '/', name: 'TeaList', component: TeaListView },
  { path: '/orders', name: 'OrderList', component: OrderListView },
  { path: '/cart', name: 'Cart', component: CartView },
  { path: '/register', name: 'Register', component: RegisterView },
  { path: '/user', name: 'UserCenter', component: UserCenterView },
  { path: '/comments', name: 'Comment', component: CommentView },
  { path: '/tea/:id', name: 'TeaDetail', component: TeaDetailView },
  { path: '/checkout', name: 'Checkout', component: CheckoutView },
  { path: '/orders/:id', name: 'OrderDetail', component: OrderDetailView },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
